/*
 * cg.h
 *
 *  Created on: 2012/06/07
 *      Author: guanxiaoying
 */

#ifndef CG_H_
#define CG_H_

typedef struct _CG_RESULT{
	AST astBegin;
	AST astEnd;
}CG_RESULT;
AST CG_ConvertToTemporaryVariable( AST astSym );
AST CG_ConvertToTempVari_CompoundLiterals( AST astExp );
AST CG_ConvertToVariable( AST astSym );
AST CG_ConvertToFunction( AST astSym );
AST CG_GetArrayMember( AST astVari, AST astConstant );
AST CG_GetStUnMember( AST astVari, AST astSym );
AST CG_ConvertMembers( AST astMemSym );
AST  CG_ConvertTypeInfo( AST astCCType );
VOID CG_CmdListSetType( AST astList, AST astCCType );
AST CG_NewStartingCmdList( AST astStmt );
AST CG_NewEndingCmdList( AST astStmt );
AST CG_NewCmdListByKind( U2 kind, AST astExp );
AST CG_NewCmdListByKind_Decl( U2 kind, AST astDecl );
AST CG_NewChooseEndCmdList(AST astExp);
AST CG_NewChooseCmdList(AST astExp);
AST CG_NewLoopStartingCmdList(AST astStmt);
AST CG_NewLoopEndingCmdList(AST astStmt);
AST CG_NewConfluxCmdList(AST astStmt, PSZ post );
AST CG_NewJumpCmdList(AST astStmt);
AST CG_NewBranchCmdList(AST astStmt);
AST CG_NewReturnCmdList(AST astStmt);
AST CG_NewFuncEntryCmdList(AST astStmt);
AST CG_NewFuncExitCmdList(AST astStmt);
CG_RESULT CG_MergeResult( CG_RESULT a, CG_RESULT b );
CG_RESULT CG_MergeCmdList( CG_RESULT a, AST astList );
AST CG_NewVariableOperand( AST astVari );
AST CG_NewConstantStringOperand( AST astConstantStr );
AST CG_NewConstantOperand( AST astConstant );
AST CG_NewResultOperand( AST astCmdList );
AST CG_NewFunctionOperand( AST astFunc );
AST CG_ConvertConstant( AST astValue );
CG_RESULT CG_Statement( AST astStmt, BOOL bSideEffect );
CG_RESULT CG_Expression( AST astExp, BOOL bSideEffect );
CG_RESULT CG_ExpPullPostIncDec( BOOL bClear );
CG_RESULT CG_AddExpression( AST astPreCmdList, AST opKind, AST astRightExp );
CG_RESULT CG_Declaration( AST astDeclaration );
AST  CG_DeclGetCurrFunction( VOID );
AST  CG_getVariDataSection( AST astDataSection );
AST  CG_getFuncDataSection( AST astDataSection );
U4  CG_dataSectionAddNew( AST astDataSection, U4 size );
VOID CG_StaticDeclaration( AST astDeclaration );
CG_RESULT CG_AssignInitializerToVariable( AST astVari, AST astInitializer, BOOL bAssign );

AST CG_NewJudgeCmdList(AST astExp );
#endif /* CG_H_ */
